﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Principal;

namespace XCommunity.Users
{
  /// <summary>
  /// 为IIdentity对象提供扩展方法
  /// </summary>
  public static class AccountExtension
  {

    public static bool IsSelf( this IIdentity account, string name )
    {
      if ( account == null )
        return false;

      if ( !account.IsAuthenticated )
        return false;

      return string.Equals( account.Name, name, StringComparison.OrdinalIgnoreCase );
    }

  }
}
